﻿using LuShanTea.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuShanTea.IService
{
    public interface IAddressService : IServiceSupport
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="addressA">参数DTO</param>
        /// <returns></returns>
        long AddNew(AddressAddNewDTO addressA);
        /// <summary>
        /// 修改,如果Id不存在则抛ArgumentException异常
        /// </summary>
        /// <param name="addressU"></param>
        void Update(AddressAddNewDTO addressU);

        long UpdateAddres(AddressAddNewDTO addressU);

        int GetAddressByUserCount(long userId);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="AddressId"></param>
        void MarkDelete(long addressId);
        /// <summary>
        /// 获取指定用户下的所有收货地址
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>如果没找到返回null</returns>
        AddressDTO[] GetAddressByUserId(long userId);
        /// <summary>
        /// 根据id查询地址
        /// </summary>
        /// <param name="addressId"></param>
        /// <returns>如果没找到，则抛 ArgumentException 异常</returns>
        AddressDTO GetByAddressId(long addressId);
        /// <summary>
        /// 获取所有地址
        /// </summary>
        /// <returns></returns>
        AddressDTO[] GetAll();
        /// <summary>
        /// 分页获取地址
        /// </summary>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageCount">一页显示多少数据</param>
        /// <returns></returns>
        AddressDTO[] GetPageAddress(int pageIndex, int pageCount);
        /// <summary>
        /// 获取数据总数量
        /// </summary>
        /// <returns></returns>
        long GetTotalCount();

        long? GetFirstAddressIdByUserId(long userId);
        bool HasAddressByUser(long userId, long addressId);

    }
}
